import os
import uiautomation
from config.config import DATA_PATH
from page.index import IndexPage
from page.药房管理.chufangfayao__page import chufangfayao
from tools.sjqd_way import read_data_from_excel
class Tiaoshi():
    his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
    his.SetFocus()
    def chufangfayao_xiyao(self):
        self.data = read_data_from_excel(os.path.join(DATA_PATH, "datas.xls"), "测试患者")
        name = self.data[0][0]
        ap = IndexPage()
        bp = chufangfayao()
        ap.click_yfgl_btn()#点击药房管理
        ap.click_cffy_btn()#点击处方发药
        bp.choose_xyf()  # 选择西药房
        bp.choose_dfy()  # 选择待发药
        bp.input_name(name)#输入患者姓名
        bp.click_cx_btn()#点击查询按钮
        bp.choose_sj1()#选择数据1
        bp.click_fy_btn()#点击发药按钮
        bp.click_qd_btn()#点击确定按钮
    def chufangfayao_zhongyao(self):
        bp = chufangfayao()
        bp.choose_zyf()#选择中药房
        bp.choose_dfy()  # 选择待发药
        bp.click_cx_btn()#点击查询按钮
        bp.shuju1.Refind()
        bp.choose_sj1()#选择数据1
        bp.click_fy_btn()#点击发药按钮
        bp.tishi.Refind()
        bp.queding.Refind()
        bp.click_qd_btn()#点击确定按钮

if __name__ == '__main__':
    Tiaoshi().chufangfayao_xiyao()
    Tiaoshi().chufangfayao_zhongyao()



